package uk.ac.ebi.bioinvindex.model.impl.processing;

import uk.ac.ebi.bioinvindex.model.impl.MaterialImpl;
import uk.ac.ebi.bioinvindex.model.impl.StudyImpl;

import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;


/**
 * User: Nataliya Sklyar (nsklyar@ebi.ac.uk)
 * Date: Jul 30, 2007
 */
@Entity
@DiscriminatorValue( "MaterialProcessing" )
public class MaterialProcessingImpl extends ProcessingImpl<MaterialNodeImpl, MaterialNodeImpl> {

	protected MaterialProcessingImpl() {
		super();
	}

	public MaterialProcessingImpl(StudyImpl study) {
		super(study);
	}

	public MaterialProcessingImpl(StudyImpl study, boolean original) {
		super(study, original);
	}


	public String toStringVerbose () 
	{
		StringBuilder result = new StringBuilder ( "ProcessingImpl { " + this.getId() + "\n" );
		
		result.append ( "  Inputs:\n" );
		for ( MaterialNodeImpl input: this.getInputNodes () ) {
			MaterialImpl material = input.getMaterial ();
			result.append ( "    " + material );
		}

		result.append ( "\n  Outputs:\n" );
		for ( MaterialNodeImpl output: this.getOutputNodes () ) {
			MaterialImpl material = output.getMaterial ();
			result.append ( "    " + material );
		}

		result.append ( "\n  Protocols:\n" );
		for ( ProtocolApplication protocolApp: this.getProtocolApplications () ) {
			result.append ( "    " + protocolApp + "\n" );
		}
		result.append ( "\n" );
		
		
		return result.toString ();
	}

}
